Skip to content

Add a contextmanager and reverse default option#12

Merged
Ericgig merged 4 commits intoqutip:mainfrom
Ericgig:add_context
Oct 16, 2025
Merged

Add a contextmanager and reverse default option#12
Ericgig merged 4 commits intoqutip:mainfrom
Ericgig:add_context

Conversation

@Ericgig
Copy link
Member

@Ericgig Ericgig commented Oct 10, 2025

The set_as_default as a new parameter: reverse which restore qutip's core default to undo the operation.

The backend can also be used with context:

>>> with qutip_cuquantum.CuQuantumBackend(cudm_ctx):
>>>     in_ctx = qutip.num(4)
>>> 
>>> out_ctx = qutip.num(4)
>>> 
>>> print(in_ctx.dtype, out_ctx.dtype)
<class 'qutip_cuquantum.operator.CuOperator'> <class 'qutip.core.data.dia.Dia'>

@Ericgig Ericgig merged commit cb3aa17 into qutip:main Oct 16, 2025
1 check passed
@Ericgig Ericgig deleted the add_context branch October 16, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant